package org.zx;

import java.lang.instrument.ClassDefinition;
import java.lang.instrument.Instrumentation;
import java.lang.instrument.UnmodifiableClassException;


/**
 * 在 main 函数开始执行以后，再启动自己的 Instrumentation 程序
 */
public class AttachAgent {
    public static void agentmain(String agentArgs, Instrumentation inst)  throws ClassNotFoundException, UnmodifiableClassException, InterruptedException {
        inst.addTransformer(new Transformer (), true);
        inst.retransformClasses(TransClass.class);
        System.out.println("Agent Main Done");
    }
}
